<template>
  <div>
    <pageHeader :title="title" :breadCrumb="breadCrumb" :show-back="true">
    </pageHeader>
    <div class="basic-item">
      <div style="width: 70%; margin-top: 20px">
        <a-form :model="form" auto-label-width>
          <a-row :gutter="24">
            <a-col :span="24">
              <a-form-item
                field="value1"
                label="认证项目名称"
                label-col-flex="100px"
              >
                <a-input
                  style=""
                  v-model="form.name"
                  placeholder="please enter..."
                />
              </a-form-item>
            </a-col>
          </a-row>
          <a-row :gutter="24">
            <a-col :span="24">
              <a-form-item
                field="value1"
                label="Value 1"
                label-col-flex="100px"
              >
                <a-textarea
                  v-model="form.description"
                  style="height: 100px"
                  placeholder="Please enter something"
                  allow-clear
                />
              </a-form-item>
            </a-col>
          </a-row>
        </a-form>
      </div>
    </div>
    <div>
      <h1 class="title">认证流程 </h1>
      <div class="title-item">
        <span style="padding-left: 40px">认证任务</span>
      </div>
      <div class="info-item">
        <div style="width: 100%; display: flex; margin: 20px 50px">
          <a-space>
            <div
              style="
                width: 4px;
                height: 15px;
                background-color: rgba(61, 126, 255, 1);
                border: none;
                border-radius: 2px;
              "
            >
            </div>
            <div>基本信息</div>
          </a-space>
        </div>
        <div style="width: 70%; margin-left: 10%"
          ><a-form :model="formData" auto-label-width>
            <a-row :gutter="16">
              <a-col :span="12">
                <a-form-item field="posts.post2" label="认证单号："
                  ><a-input placeholder="Please enter something" allow-clear
                /></a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item field="posts.post2" label="供应商编号："
                  ><a-input placeholder="Please enter something" allow-clear
                /></a-form-item>
              </a-col>
            </a-row>
            <a-row :gutter="16">
              <a-col :span="12">
                <a-form-item field="posts.post2" label="供应商名称："
                  ><a-input placeholder="Please enter something" allow-clear
                /></a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item field="posts.post2" label="供应商状态："
                  ><a-input placeholder="Please enter something" allow-clear
                /></a-form-item>
              </a-col>
            </a-row>
            <a-row :gutter="16">
              <a-col :span="12">
                <a-form-item field="posts.post2" label="任务下达时间："
                  ><a-input placeholder="Please enter something" allow-clear
                /></a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item field="posts.post2" label="下单人："
                  ><a-input placeholder="Please enter something" allow-clear
                /></a-form-item>
              </a-col>
            </a-row>
          </a-form>
        </div>
        <!-- 执行信息 -->
        <div style="width: 100%; display: flex; margin: 20px 50px">
          <a-space>
            <div
              style="
                width: 4px;
                height: 15px;
                background-color: rgba(61, 126, 255, 1);
                border: none;
                border-radius: 2px;
              "
            >
            </div>
            <div>执行信息</div>
          </a-space>
        </div>
        <div style="width: 70%; margin-left: 10%"
          ><a-form :model="formData" auto-label-width>
            <a-row :gutter="16">
              <a-col :span="12">
                <a-form-item field="posts.post2" label="任务负责人："
                  ><a-input placeholder="Please enter something" allow-clear
                /></a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item field="posts.post2" label="任务开始时间："
                  ><a-input placeholder="Please enter something" allow-clear
                /></a-form-item>
              </a-col>
            </a-row>
            <a-row :gutter="16">
              <a-col :span="12">
                <a-form-item field="posts.post2" label="任务结束时间："
                  ><a-input placeholder="Please enter something" allow-clear
                /></a-form-item>
              </a-col>
              <a-col :span="12">
                <a-form-item field="posts.post2" label="供应商状态："
                  ><div class="state-item">
                    <span style="margin-left;: 50%">代下达</span>
                  </div></a-form-item
                >
              </a-col>
            </a-row>
          </a-form>
        </div>
        <div style="width: 100%; margin: 20px 50px">
          <a-space direction="vertical" fill>
            <div> 注意事项： </div>
            <div>
              <a-textarea placeholder="Please enter something" allow-clear />
            </div>
          </a-space>
        </div>
        <div style="width: 100%; margin: 20px 50px">
          <a-space :size="20" direction="vertical" fill>
            <div>所需附件：</div>
            <div>
              <a-input
                :style="{ width: '220px' }"
                placeholder="Please enter something"
                allow-clear
              />
            </div>
            <div>
              <a-upload draggable action="/" />
            </div>
            <div style="display: flex">
              <div>
                <icon-plus />
                <a-typography-text type="primary">
                  添加附加类型
                </a-typography-text></div
              >
              <div>
                <span style="margin: 2px 50px"
                  >支持pdf、doc、docx、wps文件格式，大小不超过20MB</span
                >
              </div>
            </div>
          </a-space>
        </div>
      </div>
      <!-- 认证报告 -->
      <div class="report-item">
        <div class="title-item">
          <span>认证报告</span>
        </div>
      </div>
      <div style="width: 100%; margin: 20px 106px">
        注意事项：
        <div>
          <a-textarea placeholder="Please enter something" allow-clear />
        </div>
      </div>
      <div style="width: 100%; margin: 20px 106px">
        <a-space :size="20" direction="vertical" fill>
          <div>认证报告附件：</div>
          <div>
            <a-input
              :style="{ width: '220px' }"
              placeholder="Please enter something"
              allow-clear
            />
          </div>
          <div>
            <a-upload draggable action="/" />
          </div>
          <div style="display: flex">
            <div>
              <icon-plus />
              <a-typography-text type="primary">
                添加附加类型
              </a-typography-text></div
            >
            <div>
              <span style="margin: 2px 50px"
                >支持pdf、doc、docx、wps文件格式，大小不超过20MB</span
              >
            </div>
          </div>
        </a-space>
      </div>
      <!-- 认证 -->
      <div class="report-item">
        <div class="title-item">
          <span>认证</span>
        </div>
      </div>
      <div style="width: 100%; margin: 20px 106px">
        是否通过认证：
        <a-radio-group>
          <a-radio :value="1">
            <template #radio="{ checked }">
              <div
                align="start"
                class="custom-radio-card"
                :class="{ 'custom-radio-card-checked': checked }"
              >
                <div className="custom-radio-card-shade">
                  <div className="custom-radio-card-masky">
                    <icon-check className="custom-radio-card-mask-dot" />
                  </div>
                </div>
                <div className="custom-radio-card-shadey">
                  <a-typography-text type="secondary"> 通过 </a-typography-text>
                </div>
              </div>
            </template>
          </a-radio>

          <a-radio :value="2">
            <template #radio="{ checked }">
              <div
                align="start"
                class="custom-radio-card"
                :class="{ 'custom-radio-card-checked': checked }"
                ><div className="custom-radio-card-shade">
                  <div className="custom-radio-card-maskn">
                    <icon-check className="custom-radio-card-mask-dot" />
                  </div>
                </div>
                <div className="custom-radio-card-shaden">
                  <a-typography-text type="secondary">
                    不通过
                  </a-typography-text>
                </div>
              </div>
            </template>
          </a-radio>
        </a-radio-group>
      </div>
      <div style="width: 100%; margin: 30px 106px">
        <a-space direction="vertical" fill>
          <div> 认证意见： </div>
          <div>
            <a-textarea placeholder="Please enter something" allow-clear />
          </div>
        </a-space>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
  import { reactive, computed, ref, watchEffect } from 'vue';
  import { useRoute } from 'vue-router';
  import { getSupplierauth } from '@/api/buy-management/supplier-management/base-setting/index';
  import { cloneDeep } from 'lodash';

  const route = useRoute();
  const title: string = '供应商样品认证';
  const breadCrumb: string[] = [
    '采购管理',
    '供应商管理',
    '基础设置',
    '供应商认证项目设置',
    '供应商样品认证',
  ];

  const form = route.query;

  const formData = ref();
</script>

<style scoped lang="less">
  .basic-item {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(242, 243, 245, 0.852);
  }

  .title {
    margin-left: 45%;
  }

  .title-item {
    width: 95%;
    height: 60px;
    margin: auto;
    background-color: rgba(245, 247, 250);
    line-height: 60px;
  }

  .info-item {
    width: 100%;
  }
  .state-item {
    width: 95px;
    height: 40px;
    background: inherit;
    background-color: rgba(228, 228, 228, 1);
    border: none;
    border-radius: 100px;
    line-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: aliceblue;
  }

  .report-item {
    width: 95%;
    height: 60px;
    margin: auto;
    background-color: rgba(245, 247, 250);
    line-height: 60px;
  }

  .custom-radio-card {
    padding: 10px 16px;
    border: 1px solid var(--color-border-2);
    border-radius: 4px;
    width: 150px;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    height: 40px;
    line-height: 40px;
    display: flex;
  }

  .custom-radio-card-masky {
    height: 17px;
    width: 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 100%;
    border: 1px solid var(--color-border-2);
    box-sizing: border-box;
    margin-left: 30%;
  }

  .custom-radio-card-maskn {
    height: 17px;
    width: 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 100%;
    border: 1px solid var(--color-border-2);
    box-sizing: border-box;
    margin-left: 30%;
  }

  .custom-radio-card-mask-dot {
    width: 8px;
    height: 8px;
    border-radius: 100%;
  }

  .custom-radio-card-title {
    color: var(--color-text-1);
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 8px;
  }
  .custom-radio-card-shade {
    width: 45px;
    height: 38px;
    border-right: 1px solid var(--color-border-2);
    background-color: white;
    box-sizing: border-box;
  }

  .custom-radio-card-shadey {
    width: 105px;
    height: 38px;
    background-color: white;
    box-sizing: border-box;
  }

  .custom-radio-card-shaden {
    width: 105px;
    height: 38px;
    background-color: white;
    box-sizing: border-box;
  }

  .custom-radio-card-checked .custom-radio-card-masky {
    border-color: rgb(49, 194, 124);
  }

  .custom-radio-card-checked .custom-radio-card-maskn {
    border-color: rgb(255, 153, 0);
  }

  .custom-radio-card-checked .custom-radio-card-shadey {
    // background-color: var(--color-primary-light-1);
    // ba-color: rgb(49, 194, 124);
    color: white;
    background-color: rgb(49, 194, 124);
  }
  .custom-radio-card-checked .custom-radio-card-shaden {
    // background-color: var(--color-primary-light-1);
    // ba-color: rgb(49, 194, 124);
    color: white;
    background-color: rgb(255, 153, 0);
  }

  .custom-radio-card:hover .custom-radio-card-title,
  .custom-radio-card-checked .custom-radio-card-title {
    color: rgb(var(--primary-6));
  }

  .custom-radio-card-checked .custom-radio-card-mask-dot {
    background-color: rgb(var(--primary-6));
  }
</style>
